package com.onion.auth.support;

import com.onion.auth.support.vo.AuthUser;

public class SecurityContexts {

    private static ThreadLocal<AuthUser<?>> AUTH_USER = new ThreadLocal<>();

    public static void setAuthUser(AuthUser authUser) {
        AUTH_USER.set(authUser);
    }

    public static AuthUser<?> getCurrentUser(){
        return AUTH_USER.get();
    }

    public static void clearAuthUser(){
        if(AUTH_USER != null){
            AUTH_USER.remove();
        }
    }

}